import request from "@/utils/request";

// 获取用户列表
export function getUserList() {
  return request({
    url: "/system/user/list",
    method: "get",
  });
}

// 查询用户关联列表
export function listRelation(query) {
  return request({
    url: "/system/relation/list",
    method: "post",
    data: query,
  });
}

// 查询用户关联详细
export function getRelation(id) {
  return request({
    url: "/system/relation/" + id,
    method: "get",
  });
}

// 新增用户关联
export function addRelation(data) {
  return request({
    url: "/system/relation/add",
    method: "post",
    data: data,
  });
}

// 修改用户关联
export function updateRelation(data) {
  return request({
    url: "/system/relation/edit",
    method: "post",
    data: data,
  });
}

// 删除用户关联
export function removeRelation(ids) {
  return request({
    url: "/system/relation/remove",
    method: "post",
    data: ids,
  });
}

// 导出用户关联
export function exportRelation(query) {
  return request({
    url: "/system/relation/export",
    method: "post",
    data: query,
  });
}

// 根据老人用户ID查询关联的家属列表
export function getFamiliesByElder(elderUserId) {
  return request({
    url: "/system/relation/elder/" + elderUserId + "/families",
    method: "get",
  });
}

// 根据家属用户ID查询关联的老人列表
export function getEldersByFamily(familyUserId) {
  return request({
    url: "/system/relation/family/" + familyUserId + "/elders",
    method: "get",
  });
}
